package com.wangxinyuchuan.demo.prototype;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wangxinyuchuan
 * @date 2023/4/14 5:26 PM
 */
public class Manager {

    private Map<String, Product> map = new HashMap<>();

    public void register(String name, Product proto) {
        map.put(name, proto);
    }

    public Product create(String protoName) {
        Product product = map.get(protoName);
        return product.createClone();
    }
}
